package com.sise.bl.entity;

import org.springframework.stereotype.Component;

import javax.persistence.*;
import java.io.Serializable;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * 对应数据库的地址表
 */
@Component
public class Address implements Serializable {
    private static final long serialVersionUID = 1L;

    private Integer aid;
    private String aname; //收件人名称
    private String aphone; //收件人电话
    private String adetail; //收件人地址
    private int astate = 0; //收件地址状态 0 非默认 1默认地址
    private User user;
    private Set<Orders> orders = new HashSet<Orders>();

    public Address() {
    }

    public Address(String aname, String aphone, String adetail, int astate) {
        this.aname = aname;
        this.aphone = aphone;
        this.adetail = adetail;
        this.astate = astate;
    }

    public Integer getAid() {
        return aid;
    }

    public void setAid(Integer aid) {
        this.aid = aid;
    }

    public String getAname() {
        return aname;
    }

    public void setAname(String aname) {
        this.aname = aname;
    }

    public String getAphone() {
        return aphone;
    }

    public void setAphone(String aphone) {
        this.aphone = aphone;
    }

    public String getAdetail() {
        return adetail;
    }

    public void setAdetail(String adetail) {
        this.adetail = adetail;
    }

    public int getAstate() {
        return astate;
    }

    public void setAstate(int astate) {
        this.astate = astate;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public Set<Orders> getOrders() {
        return orders;
    }

    public void setOrders(Set<Orders> orders) {
        this.orders = orders;
    }

    @Override
    public String toString() {
        return "Address{" +
                "aid=" + aid +
                ", aname='" + aname + '\'' +
                ", aphone='" + aphone + '\'' +
                ", adetail='" + adetail + '\'' +
                ", astate=" + astate +
                ", user=" + user +
                ", orders=" + orders +
                '}';
    }
}
